const { Menu } = require('electron');
module.exports = (mainWindow) => {
  const menu = [
    {
      label: 'menu',
      submenu: [
        {
          label: 'menu1',
          click: () =>
            mainWindow.webContents.send('alertWebMsg', {
              type: 'info',
              text: 'you click menu1',
            }),
        },
        {
          label: 'menu2',
          click: () =>
            mainWindow.webContents.send('alertWebMsg', {
              type: 'success',
              text: 'you click menu2',
            }),
        },
      ],
    },
    {
      label: 'pages',
      submenu: [
        {
          label: 'home',
          click: () =>
            mainWindow.webContents.send('handle_jump', {
              path: '/',
            }),
        },
        {
          label: 'demo',
          click: () =>
            mainWindow.webContents.send('handle_jump', {
              path: '/demos',
            }),
        },
      ],
    },
  ];
  const menuInstance = Menu.buildFromTemplate(menu);
  Menu.setApplicationMenu(menuInstance);
};
